/**
 * Copyright (c) 2009-2011, chunquedong(YangJiandong)
 * 
 * This file is part of ChunMap project
 * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE(Version >=3)
 * 
 * History:
 *     2010-05-05  Jed Young  Creation
 */
package chunmap.model.relate.relateop;

import chunmap.model.geom.GeoPoint;
import chunmap.model.geom.Geometry;
import static chunmap.model.relate.IntersectionMatrix.*;
import chunmap.model.relate.ComputeIm;

/**
 * 
 * @author chunquedong
 * 
 */
public class Point_Point extends ComputeIm {

	public Point_Point(GeoPoint p1, GeoPoint p2) {
		g1 = p1;
		g2 = p2;
	}

	@Override
	protected void computeIM() {
		GeoPoint p1 = (GeoPoint) g1;
		GeoPoint p2 = (GeoPoint) g2;
		if (p1.equals(p2)) {
			im.set(Inner, Inner, PointDim);
		} else {
			im.set(Inner, Inner, EmptyDim);
			im.set(Inner, Outer, PointDim);
			im.set(Outer, Inner, PointDim);
		}
	}

	// 由于覆盖了computerIm方法，所以以下两方法未使用
	@Override
	protected int inner2innerDim(Geometry g1, Geometry g2) {
		return 0;
	}

	@Override
	protected boolean within(Geometry g1, Geometry g2) {
		return false;
	}
}